package com.geekband.Test01;

import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

/**
 * Function:
 * Create date on 15/11/17.
 *
 * @author Conquer
 * @version 1.0
 */
public class TestFragment extends Fragment {

    public static final String TAG = TestFragment.class.getSimpleName();
    public static final String ARGUMENT_NAME = "argument_name";
    public static final String ARGUMENT_NUMBER = "argument_number";


    private String mNameString;
    private String mName;
    private int mNumber;

    public static TestFragment newInstance(String nameString, int number) {

        TestFragment testFragment = new TestFragment();
        Bundle bundle = new Bundle();
        bundle.putString(ARGUMENT_NAME, nameString);
        bundle.putInt(ARGUMENT_NUMBER, number);
        testFragment.setArguments(bundle);
        return testFragment;
    }


    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);

    }


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.i(TAG, "onCreate");
        Bundle bundle = getArguments();

        if(bundle != null){
            mName = bundle.getString(ARGUMENT_NAME);
            mNumber = bundle.getInt(ARGUMENT_NUMBER);
        }

    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        Log.i(TAG, "onCreateView");

        View view = inflater.inflate(R.layout.item_phone_book_friend, container, false);

        TextView nameTextView = (TextView) view.findViewById(R.id.name_text_view);
        nameTextView.setText(mName);

        return view;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

    }

    @Override
    public void onStart() {
        super.onStart();
    }

    @Override
    public void onResume() {
        super.onResume();
    }


    @Override
    public void onPause() {
        Log.i(TAG, "onPause");
        super.onPause();
    }

    @Override
    public void onStop() {
        super.onStop();
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }

    @Override
    public void onDetach() {
        super.onDetach();
    }
}
